package com.lims.service.common.impl;

import java.util.List;


import com.lims.dao.common.ITestOfProjectDAO;
import com.lims.po.common.TestOfProject;
import com.lims.service.common.ITestOfProjectService;



public class TestOfProjectServiceImpl  implements ITestOfProjectService {
	private ITestOfProjectDAO testOfProjectDAO;

	

	public boolean deleteTestOfProject(TestOfProject testOfProject) {
		return testOfProjectDAO.deleteTestOfProject(testOfProject);
	}

	public boolean deleteTestOfProjectById(int pid) {
		return testOfProjectDAO.deleteTestOfProjectById(pid);
	}

	public boolean saveTestOfProject(TestOfProject testOfProject) {
		return testOfProjectDAO.saveTestOfProject(testOfProject);
	}

	public List<TestOfProject> selectAll() {
		return testOfProjectDAO.selectAll();
	}

	public boolean selectTestOfProjectByTestOfProjectTitle(String testOfProjectTitle) {
		return testOfProjectDAO.selectTestOfProjectByTestOfProjectTitle(testOfProjectTitle);
	}
	public boolean updateProjectTestItem(int projectId,List<TestOfProject> testOfProjects)
	{
		boolean flag=testOfProjectDAO.deleteTestOfProjectByProjectId(projectId);
		if(flag){
			boolean fla=true;
			for(TestOfProject testOfProject:testOfProjects){
				if(!testOfProjectDAO.saveTestOfProject(testOfProject)){
					fla=false;
				}
			}
			return fla;
		}
		else{
			return false;
		}
		
	}
	public boolean updateTestOfProject(TestOfProject testOfProject) {
		return testOfProjectDAO.updateTestOfProject(testOfProject);
	}
	public TestOfProject selectTestOfProjectById(int pid) {
		return testOfProjectDAO.selectTestOfProjectById(pid);
	}

	public ITestOfProjectDAO getTestOfProjectDAO() {
		return testOfProjectDAO;
	}

	public void setTestOfProjectDAO(ITestOfProjectDAO testOfProjectDAO) {
		this.testOfProjectDAO = testOfProjectDAO;
	}
}
